package com.aliyun.dts.deliver.connector.desination;

import com.aliyun.dts.deliver.commons.config.Settings;

import java.util.concurrent.TimeUnit;

public interface DStoreReplicateHandler {

    Settings.Setting<String> CHECK_POINT_PREFER_CONFIG = Settings.stringSetting(
            "checkpointPrefer", "use which checkpoint, KAFKA,DB,CONFIG", "KAFKA");

    Settings.Setting<String> LAST_CHECK_POINT_CONFIG = Settings.stringSetting(
            "lastCheckpoint", "use this checkpoint if store data cleaned, format is offset@timestampms@lsn");

    Settings.Setting<Integer> KAFKA_BATCH_SIZE_CONFIG = Settings.integerSetting(
            "kafka.batch.size", "batch size of producer", 8388608);

    Settings.Setting<Integer> KAFKA_REQUEST_TIMEOUT_MS_CONFIG = Settings.integerSetting(
            "kafka.request.timeout.ms", "The configuration controls the maximum amount of time the client will wait "
                    + "for the response of a request. If the response is not received before the timeout "
                    + "elapses the client will resend the request if necessary or fail the request if "
                    + "retries are exhausted.", (int) TimeUnit.SECONDS.toMillis(60));

    Settings.Setting<String> KAFKA_COMPRESSION_TYPE_CONFIG = Settings.stringSetting(
            "kafka.compression.type", "The compression type for all data generated by the producer. "
                    + "The default is none (i.e. no compression). Valid " + " values are <code>none</code>, <code>gzip</code>,"
                    + " <code>snappy</code>, or <code>lz4</code>. Compression is of full batches of data, so the efficacy of "
                    + "batching will also impact the compression ratio (more batching means better compression).", "lz4");

    Settings.Setting<Integer> KAFKA_BUFFER_MEMORY_CONFIG = Settings.integerSetting(
            "kafka.buffer.memory", "buffer memory size of producer", 50331648);

    Settings.Setting<Long> LINGER_MS_CONFIG = Settings.longSetting(
            "linger.ms", "kafka linger.ms", 100L);

    Settings.Setting<Boolean> SKIP_CONFIG = Settings.booleanSetting(
            "skip", "skip all data", false);

    String CLIENT_COORDINATOR_PREFIX = "clientCoordinator";

    Settings.Setting<Integer> CLIENT_COORDINATOR_POLL_TIMEOUT_MS_CONFIG = Settings.integerSetting(
            CLIENT_COORDINATOR_PREFIX + ".poll.timeout.ms", "", -1);

    Settings.Setting<Integer> CLIENT_COORDINATOR_REBALANCE_TIMEOUT_MS_CONFIG = Settings.integerSetting(
            CLIENT_COORDINATOR_PREFIX + ".rebalance.timeout.ms", "", 60_000);

    Settings.Setting<Integer> CLIENT_COORDINATOR_SESSION_TIMEOUT_MS_CONFIG = Settings.integerSetting(
            CLIENT_COORDINATOR_PREFIX + ".session.timeout.ms", "", 120_000);

    Settings.Setting<Integer> CLIENT_COORDINATOR_HEARTBEAT_INTERVAL_MS_CONFIG = Settings.integerSetting(
            CLIENT_COORDINATOR_PREFIX + ".heartbeat.interval.ms", "skip all data", 40_000);

}
